<?php
if(!defined('BZ_XTBLOG') || !defined('BZ_WJSCUZ')) {
	exit('Access Denied');
}
$plugin_title='签到中心 - ';
$plugin_keywords='签到中心,';
$plugin_description='签到中心 - ';
if(!$user_uid){
	 $pdid='1';
}else if($_GET['act'] == 'ok'){
      if(!$row=$db->get_one('plugin_qiandao',"`uid` ='$user_uid'",'day,time_a')){
	             $db->insert('plugin_qiandao',"`uid` ,`day`,`content`,`time_a`","'$user_uid', '0', '0', '1419000166'");
	             $row=$db->get_one('plugin_qiandao',"`uid` ='$user_uid'",'day,time_a');
      }
	             if(date('md',$row[time_a]) == date('md') ){
		              $tjts='你今天已经签到过了！每天在来吧！';
	             }else{
		              if(plugin_szname('Bingz_qiandao_fangs') == 'random'){
		              	 $jifen=explode(",",'jifen,money,yeobi,renminbi');
		              	 $money=rand(1,'4');
		              	 if($money == '4'){
		              	 	  $money='0';
		              	 }
		              	 $fangs=$jifen[''.$money.''];
		              }else{
		              	 $fangs=plugin_szname('Bingz_qiandao_fangs');
		              }
		              Bingz_management($user_uid,$fangs,'+'.plugin_szname('Bingz_qiandao_'.$fangs.''),'签到奖励！','',plugin_szname('Bingz_qiandao_pass'));
	                $db->update('plugin_qiandao',"`day` = `day`+1, `content` = '$_POST[mm]', `time_a` = '$time' "," `uid` ='$user_uid'");
		              $tjts='签到成功！';
                  if(plugin_szname('Bingz_qiandao_forum_sz') == '1'){
                  	 $qdtsname='[ys=#ff0000]会员签到[/ys]：('.$_POST[mm].')[br][ys=#ff0000]获取奖励[/ys]：'.Bingz_management_name($fangs).'[b]+[/b][ys=#ff0000]'.plugin_szname('Bingz_qiandao_'.$fangs.'').'[/ys][br][br]来自【[url='.$plugin_Address.']签到中心[/url] 】';
                  	 $forumid=plugin_szname('Bingz_qiandao_forum');
               	     if($forum=$db->get_one('forum_class'," `id` ='$forumid' ",'')){
               	        $txt=date("Y-m-d").'签到记录';
               	        if($forumuser=$db->get_one('forum'," `cid` ='$forum[id]' and `name` ='$txt' and `sz_sc` ='0' ",'')){
               	     	      $mm=''.$qdtsname;
               	     	      Bingz_forum_hui_post($forumuser[id],$user_uid,$mm);
               	     	      $foid=$forumuser[id];
                        }else{
                     	      $mm=$qdtsname.'[br]';
               	     	      $rposition=plugin_szname('Bingz_qiandao_forum_logo');
               	     	      if($fmpuid=Bingz_forum_upload_post($user_uid,$rposition)){
               	     	      	$mm='[attach]'.$fmpuid.'[/attach][br]'.$mm;
               	     	      }
               	     	      $foid==Bingz_forum_post($forum[id],$user_uid,$txt,$mm,'1');
               	        }
               	     }
                  }
               }
	 $pdid='2';
}else if($_GET['act'] == 'phb'){
   $num_count=$db->num_rows('plugin_qiandao'," ",'uid');
   $list_num ="10";
   $num_start=page_num($list_num,$num_count);
   $sql_bbs  =$db->query('plugin_qiandao',"  ORDER BY `day` DESC LIMIT ".$num_start." , ".$list_num." ",'');
   while($aaw=mysql_fetch_array($sql_bbs)){
   	    $tx =$user_class->user_tx($aaw[uid]);
   	    $hyname =$user_class->user_name($aaw[uid]);
   	    $time_a=Bingz_time_f($aaw['time_a']);
   	    $content=$aaw[content];
	      $qiandao[]= array("hyuid"=>"$aaw[uid]","hyname"=>"$hyname","time_a"=>"$time_a","day"=>"$aaw[day]","logo"=>"$tx","content"=>"$content");
   }
   $page=page_link($list_num,$num_count);
	 $pdid='3';
}else{
	 $qdname=plugin_szname('Bingz_qiandao_text');
   $qiandao=$db->get_one('plugin_qiandao'," `uid` ='$user_uid' ",'');
   $ts=$qiandao[day];
   $timemm=Bingz_time($qiandao[time_a]);
		              if(plugin_szname('Bingz_qiandao_fangs') == 'random'){
		              	 $fangs=Bingz_management_name('jifen').'奖励=<font color="ff0000">'.plugin_szname('Bingz_qiandao_jifen').'</font>'.
		              	        Bingz_management_name('money').'奖励=<font color="ff0000">'.plugin_szname('Bingz_qiandao_money').'</font>'.
		              	        Bingz_management_name('yeobi').'奖励=<font color="ff0000">'.plugin_szname('Bingz_qiandao_yeobi').'</font>'.
		              	        Bingz_management_name('renminbi').'奖励=<font color="ff0000">'.plugin_szname('Bingz_qiandao_renminbi').'</font>'.
		              	        '以上四种币随机抽取一种';
		              }else{
        	           $fangs=Bingz_management_name(plugin_szname('Bingz_qiandao_fangs')).'奖励=<font color="ff0000">'.plugin_szname('Bingz_qiandao_'.plugin_szname('Bingz_qiandao_fangs').'').'</font>';
		              }
}
$templatesplugin='index.htm';
?>